package com.csun.cmny.provider.task;

import com.csun.cmny.provider.config.RedisInitRunner;
import com.csun.cmny.provider.service.OmcOldManBillService;
import lombok.extern.slf4j.Slf4j;
import org.activiti.spring.SpringCallerRunsRejectedJobsHandler;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.json.SpringHandlerInstantiator;
import org.springframework.scheduling.quartz.QuartzJobBean;

import javax.annotation.Resource;
import java.io.Serializable;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-04-18 20:44
 * @Description:
 */
@Slf4j
public class PeriodQuartz extends QuartzJobBean {

    @Resource
    OmcOldManBillService oldManBillService;

   @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobDataMap jobMap = jobExecutionContext.getJobDetail().getJobDataMap();
        Long groupId = jobMap.getLong("groupId");//机构ID
        if (null != groupId && groupId > 0) {
            //执行机构生成周期账单的方法
            oldManBillService.addPeriodBill(groupId);
        }
    }
}
